package main

import "fmt"

func prinSlice(s [] int)  {

	fmt.Printf("%v ,len=%d ,cap=%d \n",s,len(s),cap(s))
}
func main() {

	var s  [] int //Zero Value for slice is nil

	for i:=0;i<100 ;i++  {
		prinSlice(s)
		s = append(s ,2*i+1)
	}
	fmt.Println(s)

	s1 := [] int{2,4,6,8}
	prinSlice(s1)

	s2 :=make([] int ,16)
	prinSlice(s2)
	s3 := make([] int ,32)
	prinSlice(s3)
	var s4  [10] int
	prinSlice(s4[:])


	fmt.Println("Copying  slice ")
	copy(s2,s1)
	prinSlice(s2)
	fmt.Println("delete element from slice ")
	s2 = append(s2[:3] , s2[4:]...)
	prinSlice(s2)


	fmt.Println("Popping from front")
	front := s2[0]
	s2 = s2[1:]
	fmt.Println("Popping from back")

	tail :=  s2[len(s2)-1]

	s2 = s2[:len(s2) -1]
	fmt.Println(front,tail)
	prinSlice(s2)

}
